public class ListMaker {

	private Shopper shopper;
	
	//Returns products (ie shopping list) based on profile and circumstance
	public Product[] getProducts(String profile, String circumstance){
		//Creates shopper based on profile
		if(profile.equalsIgnoreCase("Single")){
			shopper = new Single();
		}
		else if(profile.equalsIgnoreCase("Family")){
			shopper = new Family();
		}
		else if(profile.equalsIgnoreCase("Retired")){
			shopper = new RetiredCouple();
		}

		//Creates array of products (the shopping list)
		Product[] result;
		//Gets products from shopper profile by sending circumstance to method
		result = shopper.getProducts(circumstance);
		return result;
	}
	
	public boolean checkInput(String profile,String circumstance){
		//If one of the fields was blank, return false
		if(profile == null || circumstance == null){
			return false;
		}
		/*Return True if profile field equals "Single" or "Family" or "Retired" (Ignores case) AND
		 if circumstance equals "Weekday" or "Weekend" or "Summer" or "Winter"*/
		else{
			return((profile.equalsIgnoreCase("Single") || profile.equalsIgnoreCase("Family") || profile.equalsIgnoreCase("Retired")) && 
					(circumstance.equalsIgnoreCase("Weekday") || circumstance.equalsIgnoreCase("Weekend") || 
					circumstance.equalsIgnoreCase("Summer") || circumstance.equalsIgnoreCase("Winter")));
		}
	}
}
